<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="设备id">
              <a-input placeholder="请输入设备id" v-model="queryParam.equipmentId"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="设备编号">
              <a-input placeholder="请输入设备编号" v-model="queryParam.equipmentNo"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->


    <!-- table区域-begin -->
    <div>


      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
       
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">
          <a-button type="primary" icon="plus" @click="handlerOpenControl(record)">查看监控</a-button>
        </span>

      </a-table>
    </div>
     <zwgl-vedio-modal ref="vedioModal" :zwglUrl="vediourla"></zwgl-vedio-modal> 
  
   <!--  <Videoa :message="vediourla"></Videoa> -->
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import ZwglDatianMonitoringModal from './modules/ZwglDatianMonitoringModal'
  import ZwglVedioModal from './ZwglVedioModal.vue'

  export default {
    name: 'ZwglDatianMonitoringList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      ZwglDatianMonitoringModal,
      ZwglVedioModal,
    },
    data () {
      return {
        description: '大田监控管理页面',
       vediourla:"",
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'设备id',
            align:"center",
            dataIndex: 'equipmentId'
          },
          {
            title:'设备编号',
            align:"center",
            dataIndex: 'equipmentNo'
          },
          // {
          //   title:'设备名称',
          //   align:"center",
          //   dataIndex: 'equipmentName'
          // },
          // {
          //   title:'设备类型',
          //   align:"center",
          //   dataIndex: 'equipmentType'
          // },
          // {
          //   title:'设备类型名称',
          //   align:"center",
          //   dataIndex: 'equipmentTypeName'
          // },
          // {
          //   title:'站点id',
          //   align:"center",
          //   dataIndex: 'stationId'
          // },
          {
            title:'站点名称',
            align:"center",
            dataIndex: 'stationName'
          },
          {
            title:'视频地址',
            align:"center",
            dataIndex: 'videoUrl'
          },
           {
            title:'经度',
            align:"center",
            dataIndex: 'lng'
          },
           {
            title:'纬度',
            align:"center",
            dataIndex: 'lat'
          },
          // {
          //   title:'在线状态',
          //   align:"center",
          //   dataIndex: 'online'
          // },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/dtwlwjc/zwglDatianMonitoring/list",
          delete: "/dtwlwjc/zwglDatianMonitoring/delete",
          deleteBatch: "/dtwlwjc/zwglDatianMonitoring/deleteBatch",
          exportXlsUrl: "/dtwlwjc/zwglDatianMonitoring/exportXls",
          importExcelUrl: "dtwlwjc/zwglDatianMonitoring/importExcel",

        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
    this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
      handlerOpenControl(record){
        this.$refs.vedioModal.showDialog(record.videoUrl)
        
      //   console.log(record.videoUrl);
        this.vediourla=record.videoUrl;
    },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'equipmentId',text:'设备id',dictCode:''})
        fieldList.push({type:'string',value:'equipmentNo',text:'设备编号',dictCode:''})
        fieldList.push({type:'string',value:'equipmentName',text:'设备名称',dictCode:''})
        fieldList.push({type:'string',value:'equipmentType',text:'设备类型',dictCode:''})
        fieldList.push({type:'string',value:'equipmentTypeName',text:'设备类型名称',dictCode:''})
        fieldList.push({type:'string',value:'stationId',text:'站点id',dictCode:''})
        fieldList.push({type:'string',value:'stationName',text:'站点名称',dictCode:''})
        fieldList.push({type:'string',value:'videoUrl',text:'视频地址',dictCode:''})
        fieldList.push({type:'string',value:'online',text:'在线状态',dictCode:''})
        fieldList.push({type:'string',value:'lng',text:'经度',dictCode:''})
        fieldList.push({type:'string',value:'lat',text:'纬度',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>